<?php
// +----------------------------------------------------------------------

namespace app\user\model;

use think\Model as ThinkModel;
use app\user\model\Vip as VipModel;
use think\facade\Db;

/**
 * 资金流水模型
 * @package app\cms\model
 */
class MoneyTake extends ThinkModel
{
    // 设置当前模型对应的完整数据表名称
    protected $name = 'user_money_take';

    // 自动写入时间戳
    protected $autoWriteTimestamp = true;

    /**
     * 获取资金流水列表
     * @return array|mixed
     */
    public static function getList($map = [], $order = [], $paginate = 0)
    {
		if ($paginate == 0) $paginate = config('paginate');
        $data_list = self::view('user_money_take', true)
            ->view("user_vip", ['realname','mobile','group', 'money_take' => 'money_store'], 'user_vip.member_id=user_money_take.uid', 'left')
            ->where($map)
            ->order($order)
            ->paginate($paginate);
        return $data_list;
    }
	
	/**
	 * 变动模式
	 * @param int $id 类型id
	 * @author paulxun
	 * @return array|static
	 */
	public static function status($id = 99)
	{
		$types = [
			0 => '已申请',
			1 => '已确认',
			2 => '已提现',
		];
	    if ($id === 99) {
	        $result = $types;
	    }else{
			$result = '';
			if(isset($types[$id])) $result = $types[$id];
		}
	    return $result;
	}
}
